import {
  legacy_createStore as createStore,
  combineReducers,
  applyMiddleware,
} from "redux";
import userReducer from "./user/userReducer";
import logger from "redux-logger";
import { l } from "../utils";
const reducer = combineReducers({
  user: userReducer,
});
const store = createStore(reducer, applyMiddleware(logger));
export type RootState = ReturnType<typeof store.getState>;
store.subscribe(() => {
  const state = store.getState();
  l.setItem("token", state.user.token);
});
export default store;
